<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src='../day14/jquery.js'></script>
</head>
<body>
    <table width="100%" cellpadding="0" border="1" cellspacing="0">
        <thead>
            <tr>
                <th>编号</th>
                <th>名称</th>
                <th>描述</th>
                <th>序号</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td style='text-align: center;'>
                    <a>删除</a>
                    <a>编辑</a>
                </td>
            </tr>
        </tbody>
    </table>
</body>
<script>
    var baseUrl = 'http://47.93.206.13:8002'
    function findAll(){
            $.ajax({
            method:'get',
            url:baseUrl+'/index/findAllCategory',
            success: function(res) {
                var data = res.data
                
                data.forEach(function(item) {
                    //1.创建一个新的tr
                    var newTr = $('table tbody tr:first').clone(true)
                    newTr.children('td').eq(0).html(item.id)
                    newTr.children('td').eq(1).html(item.name)
                    newTr.children('td').eq(2).html(item.description)
                    newTr.children('td').eq(3).html(item.no)

                    $('table tbody').append(newTr)
                })
                $('table tbody tr').filter(function(index) {
                    return index == 0
                }).remove()
            }
        })
    }
    findAll()
</script>
</html>